<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<meta name="viewport" content="width=1000, initial-scale=1.0, maximum-scale=1.0">
	    <!-- Loading Bootstrap -->
	    <link href="./Public/Admin/Flat/dist/css/vendor/bootstrap.min.css" rel="stylesheet">
	    <!-- Loading Flat UI -->
	    <link href="./Public/Admin/Flat/dist/css/flat-ui.css" rel="stylesheet">
	    <link rel="shortcut icon" href="./Public/Admin/Flat/img/favicon.ico">
	    <!-- HTML5 shim, for IE6-8 support of HTML5 elements. All other JS at the end of file. -->
	    <!--[if lt IE 9]>
	      <script src="dist/js/vendor/html5shiv.js"></script>
	      <script src="dist/js/vendor/respond.min.js"></script>
	    <![endif]-->
	     <!--载入百度编辑器所需js文件-->
	    	<script type="text/javascript" charset="utf-8" src="Public/Admin/ueditor1_4_3/ueditor.config.js"></script>
    		<script type="text/javascript" charset="utf-8" src="Public/Admin/ueditor1_4_3/ueditor.all.min.js"> </script>
    		<script type="text/javascript" charset="utf-8" src="Public/Admin/ueditor1_4_3/lang/zh-cn/zh-cn.js"></script>
    		<!-- 需要载入上传的文件 -->
		    <script type="text/javascript" src="Public/Admin/uploadify/jquery-1.8.2.min.js"></script>
		    <script type="text/javascript" src="Public/Admin/uploadify/jquery.uploadify.min.js"></script>
		    <link rel="stylesheet" type="text/css" href="Public/Admin/uploadify/uploadify.css">
	    	<script src="./Public/Admin/goods.js" type="text/javascript" charset="utf-8"></script>
		    	
		    		<script type="text/javascript">
        $(function() {
            $('#f').uploadify({
                'formData'     : {//POST数据
                    '<?php echo session_name();?>' : '<?php echo session_id();?>',
                },
                'fileTypeDesc' : '上传文件',//上传描述
                'fileTypeExts' : '*.jpg;*.png;*.jpeg',
                'swf'      : '{{__PUBLIC__}}/Admin/uploadify/uploadify.swf',
                'uploader' : "{{U('upload')}}",//指定服务器上传的方法
                'buttonText':'选择文件',
                'fileSizeLimit' : '2000000KB',
                'uploadLimit' : 10,//上传文件数
                'width':65,
                'height':25,
                'successTimeout':10,//等待服务器响应时间
                'removeTimeout' : 0.2,//成功显示时间
                'onUploadSuccess' : function(file, data, response) {
                    data=$.parseJSON(data);
                    //获得图片地址
                    var imageUrl = data.url;
                    var li="<li>";
                    li += "<img src='"+imageUrl+"'/>";
                    li += "<input type='hidden' name='pic[]' value='"+data.path+"'/>";
                    li += "</li>";
                    $("#uploadList ul").prepend(li);
                }
            });
        $('#f1').uploadify({
                'formData'     : {//POST数据
                    '<?php echo session_name();?>' : '<?php echo session_id();?>',
                },
                'fileTypeDesc' : '上传文件',//上传描述
                'fileTypeExts' : '*.jpg;*.png;*.jpeg',
                'swf'      : '{{__PUBLIC__}}/Admin/uploadify/uploadify.swf',
                'uploader' : "{{U('upload')}}",//指定服务器上传的方法
                'buttonText':'选择文件',
                'fileSizeLimit' : '2000000KB',
                'uploadLimit' : 10,//上传文件数
                'width':65,
                'height':25,
                'successTimeout':10,//等待服务器响应时间
                'removeTimeout' : 0.2,//成功显示时间
                'onUploadSuccess' : function(file, data, response) {
                    //转为json
                    data=$.parseJSON(data);
                    //获得图片地址
                    var imageUrl = data.url;
                    var li="<li>";
                    li += "<img src='"+imageUrl+"'/>";
                    li += "<input type='hidden' name='big[]' value='"+data.path+"'/>";
                    li += "</li>";
                    $("#uploadList-2 ul").prepend(li);
                }
            });
        });
    </script>
	</head>
	<body>
		<form action="" method="post" enctype="multipart/form-data">
		<div class="alert alert-success">添加商品</div>
		<div class="btn btn-sm btn-primary">基本信息</div>
		<div class="form-group">
			<label for="exampleInputEmail1">所属分类</label>
			<select name="class_cid" class="form-control">
				<option value="">请选择</option>
				{{foreach from="$cateData" value="$v"}}
					<option value="{{$v['cid']}}" tid = "{{$v['type_tid']}}">{{$v['_name']}}</option>
				{{endforeach}}
			</select>
		</div>
		<div class="form-group">
			<label for="exampleInputEmail1">所属品牌</label>
			<select name="brand_bid" class="form-control">
				<option value="">请选择</option>
				{{foreach from="$brandData" value="$v"}}
					<option value="{{$v['bid']}}">{{$v['bname']}}</option>
				{{endforeach}}
			</select>
		</div>
		<div class="form-group">
			<label for="exampleInputEmail1">商品名称</label>
			<input id="exampleInputEmail1" class="form-control" type="text" placeholder="" required="" name="gname">
		</div>
		<div class="form-group">
			<label for="exampleInputEmail1">单位(件)</label>
			<input id="exampleInputEmail1" class="form-control" type="text" placeholder="" required="" name="unit">
		</div>
		<div class="form-group">
			<label for="exampleInputEmail1">市场价</label>
			<input id="exampleInputEmail1" class="form-control" type="text" placeholder="" required="" name="marketprice">
		</div>
		<div class="form-group">
			<label for="exampleInputEmail1">商城价</label>
			<input id="exampleInputEmail1" class="form-control" type="text" placeholder="" required="" name="shopprice">
		</div>
		<div class="form-group">
			<label for="exampleInputEmail1">点击次数</label>
			<input id="exampleInputEmail1" class="form-control" type="text" placeholder="" required="" name="click">
		</div>
		<div class="btn btn-sm btn-primary">商品属性</div>
		<table class="table table-hover" id="attr">
			
		</table>
		<hr />
		<div class="btn btn-sm btn-primary">商品规格</div>
		<div id="spec"></div>
				
		
		<hr />
		<table>
			<tr>
				<th class="btn btn-success">列表图</th>
			</tr>
			<tr>
				<td>上传图片</td>
				<td>
					<div>
						 <input id="f" type="file" multiple="true" >
    					 <span>类型: *.jpg,*.png 大小: 2000KB 数量: 10</span>
    					<div id='uploadList'>
    					 	<ul>
    					 		
    					 	</ul>
    					 </div>
					</div>
				</td>
			</tr>
		</table>
		<hr />
		<table>
			<tr>
				<th class="btn btn-success">商品图册</th>
			</tr>
			<tr>
				<td>上传图片</td>
				<td>
					<div>
						 <input id="f1" type="file" multiple="true">
    					 <span>类型: *.jpg,*.png 大小: 2000KB 数量: 10</span>
    					 <div id='uploadList-2'>
    					 	<ul>
    					 		
    					 	</ul>
    					 </div>
					</div>
				</td>
			</tr>
		</table>
		<hr />
		<div class="btn btn-sm btn-primary">商品详细	</div>
		<!--调用百度编辑器-->
			<script id="editor" type="text/plain" style="width:100%;height:500px;" name="intro"></script>
			<script>
		        var ue = UE.getEditor('editor');
		    </script>
		    <hr />
		  <div class="btn btn-sm btn-primary">售后服务</div> 
		<!--调用百度编辑器-->
			<script id="editor1" type="text/plain" style="width:100%;height:500px;" name="service"></script>
			<script>
		        var ue = UE.getEditor('editor1');
		    </script>
		<button class="btn btn-primary btn-block" type="submit"> 确定 </button>
		</form>
	</body>

</html>
